home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / DATABASE.DIR / 00081_Script_DB INITIALIZE-LEAVE < prev    next >
Text File  |  1996-03-28  |  8KB  |  264 lines

  1. -- ---------------------------------------------------------------
  2. -- NOTE:  Make sure the field "browserTopics" has a blank line
  3. -- at the end. This ensures that the field "browser" will alsways
  4. -- end with a blank line.  If not, when you click on the last line
  5. -- in the browser, for some strange reason, the line disappears and
  6. -- does not hilite.
  7.  
  8.  
  9. -- ---------------------------------------------------------------
  10. -- Handler initializeData initializes the database.
  11.  
  12. on initializeData
  13.   waitcursor
  14.   clearSearchTopicField
  15.   setDatabaseButtonDefault 
  16.   initIndexIndex
  17.   setDatabaseSprites
  18.   setDatabasePuppets
  19.   setDatabaseCursors
  20.   setDatabaseConstraints
  21.   setDatabaseTextGlobals
  22.   setDatabaseBrowserGlobals
  23.   setDatabaseFieldAttributes
  24.   setDatabaseMisc
  25.   initTextCastNumbersList
  26.   initalizeEquivalentTerms
  27.   clearDatabase
  28.   
  29.   setBrowserText
  30.   
  31.   normalcursor
  32. end
  33.  
  34. -- ---------------------------------------------------------------
  35. -- Handler setDatabaseButtonDefault sets the default button states.
  36.  
  37. on setDatabaseButtonDefault whichType
  38.   global defaultButtonStates
  39.   
  40.   set defaultButtonStates = "text 1:picture 0"
  41.   
  42.   if whichType = "Help" then
  43.     -- set buttons on or off stage
  44.     
  45.   else if whichType = "Database" then
  46.     -- set buttons on or off stage
  47.   end if
  48. end
  49.  
  50.  
  51. -- ---------------------------------------------------------------
  52. -- Handler setDatabaseSprites defines and initializes the global
  53. -- variables used to store the sprite information in the database.
  54.  
  55. on setDatabaseSprites
  56.   global browser, textSprite, title
  57.   global browserScroll
  58.   global indexButton, searchButton, findButton, inputField
  59.   global mediaButton, pictureButton, textButton
  60.   global hilitTopic, hiliteSprite
  61.   global pageUpButton, pageDownButton, pictureSprite,constraintScrollBar
  62.   global lineSprite,origScrollPos, captionSprite
  63.   
  64.   set origScrollPos  = 158
  65.   set indexButton = 2
  66.   set searchButton = 3
  67.   set findButton = 4
  68.   set mediaButton = 5
  69.   set textButton = 6
  70.   set pictureButton = 7
  71.   set constraintScrollBar = 11
  72.   set browserScroll = 12
  73.   set browser = 13
  74.   set textSprite = 14
  75.   set title = 15
  76.   set inputField = 16
  77.   set hilitTopic = 17
  78.   set pictureSprite = 18
  79.   set pageUpButton = 19
  80.   set pageDownButton = 20
  81.   set captionSprite = 21
  82.   set lineSprite = 23
  83. end
  84.  
  85. -- ---------------------------------------------------------------
  86. -- Handler setDatabasePuppets sets the database puppets.
  87.  
  88. on setDatabasePuppets
  89.   global textButton, pictureButton, mediaButton
  90.   global indexButton, searchButton, findButton, inputField
  91.   global browserScroll, hilitTopic, textSprite
  92.   global pageUpButton, pageDownButton, pictureSprite
  93.   
  94.   puppetSprite textButton, TRUE
  95.   puppetSprite pictureButton, TRUE
  96.   puppetSprite mediaButton, TRUE
  97.   puppetSprite indexButton, TRUE
  98.   puppetSprite searchButton, TRUE
  99.   puppetSprite findButton, TRUE
  100.   puppetSprite inputField, TRUE
  101.   puppetSprite browserScroll, TRUE
  102.   puppetSprite hilitTopic, TRUE
  103.   puppetSprite textSprite, TRUE
  104.   puppetSprite pageUpButton, TRUE
  105.   puppetSprite pageDownButton, TRUE
  106.   puppetSprite pictureSprite, TRUE
  107.   puppetSprite captionSprite, TRUE
  108. end
  109.  
  110. -- ---------------------------------------------------------------
  111. -- Handler setDatabaseCursors sets the database cursors.
  112.  
  113.  
  114. on setDatabaseCursors
  115.   global fingerCursor, browserScroll, searchSprite
  116.   global searchButton, indexButton, mediaButton
  117.   global pageUpButton, pageDownButton
  118.   
  119.   set the cursor of sprite mediaButton = fingerCursor
  120.   set the cursor of sprite searchButton = fingerCursor
  121.   set the cursor of sprite indexButton = fingerCursor
  122.   set the cursor of sprite browserScroll = fingerCursor
  123.   set the cursor of sprite 9 = fingerCursor -- browser scrollup arrow
  124.   set the cursor of sprite 8 = fingerCursor -- browser scrollDown arrow
  125.   set the cursor of sprite pageDownButton = fingerCursor -- nextPage
  126.   set the cursor of sprite pageUpButton = fingerCursor -- prevPage
  127. end
  128.  
  129. -- ---------------------------------------------------------------
  130. -- Handler setDatabaseConstraints sets the constraint of the
  131. -- scroll button.
  132.  
  133. on setDatabaseConstraints
  134.   global browserScroll, constraintScrollBar
  135.   
  136.   set the constraint of sprite browserScroll = constraintScrollBar
  137. end
  138.  
  139. -- ---------------------------------------------------------------
  140. -- Handler setDatabaseTextGlobals sets the global variables used
  141. -- for the text in the database.
  142.  
  143. on setDatabaseTextGlobals
  144.   global textColor, bkgndColor, regularStyle, hilitBackground, hilitForeground
  145.   global hilitTextColor, hypertextHiliteColor, hyperMediaLinkColor
  146.   
  147.   set regularStyle = "plain"
  148.   set textColor = 255 -- black
  149.   set bkgndColor = 0 -- grey
  150.   set hilitBackground = 8
  151.   set hilitForeground =255 -- bkgndColor
  152.   set hilitTextColor = 235 -- bright blue
  153.   set hypertextHiliteColor = 230 -- green
  154.   set hyperMediaLinkColor = 35 -- bright red
  155. end
  156.  
  157. -- ---------------------------------------------------------------
  158. -- Handler setDatabaseFieldAttributes
  159.  
  160. on setDatabaseFieldAttributes
  161.   -- set the attributes of the browser
  162.   setBrowserAttributes
  163.   
  164.   -- set the attributes of the hiliteText field
  165.   setHilitTopicAttributes
  166.   
  167.   -- set the attributes of the title field
  168.   setTitleAttributes
  169. end
  170.  
  171. -- ---------------------------------------------------------------
  172. -- Handler setDatabaseMisc
  173.  
  174. on setDatabaseMisc
  175.   -- set globals for history of links
  176.   --  global numRecent
  177.   --  set numRecent = 5
  178.   --  resetRecentChoices
  179.   
  180.   -- set page up and down button locations
  181.   global pageUpH, pageUpV, pageDownH, pageDownV
  182.   set pageUpH = 535
  183.   set pageUpV = 417
  184.   set pageDownH = 535
  185.   set pageDownV = 433
  186.   
  187.   -- Misc.
  188.   global alphabetTopicStarts
  189.   put field "AlphabetLineStarts" into alphabetTopicStarts
  190.   
  191.   set the keyDownScript = "displayKeyLineAtTop"
  192.   set the keyUpScript = EMPTY
  193.   setClearedFlag(FALSE)
  194.   setIndexMode
  195.   
  196.   global buttonStates
  197.   set buttonStates = field "button states"  
  198.   
  199.   global pictureL, pictureR,pictureT, pictureB,pictureSprite
  200.   set pictureR = 560
  201.   set pictureL = 320 
  202.   set pictureT = 63
  203.   set pictureB = 417
  204.   
  205.   global pictureH, pictureV
  206.   set pictureH = 388
  207.   set pictureV = 250
  208.   
  209.   set the stretch of sprite pictureSprite =FALSE
  210.   
  211.   global captionV, captionH, captionSprite
  212.   set captionH = 238
  213.   set captionV = 58
  214.   setCaptionAttributes(the castNum of sprite captionSprite)
  215.   
  216.   global numPagesAll, numPicturesAll
  217.   set numPagesAll = field "numPages per Topic"
  218.   set numPicturesAll = field "numPictures per Topic"
  219.   
  220.   global pictureTitles
  221.   set pictureTitles = field "pictureTitles"
  222.   
  223.   global mediaTopics
  224.   set mediaTopics = field "mediaTopics"
  225.   
  226.   global textSprite
  227.   set the editableText of sprite textSprite = FALSE
  228. end
  229.  
  230. -- ---------------------------------------------------------------
  231. -- Handler leaveDB gets director ready for the next movie (shuts
  232. -- off the puppets used in the database etc.) To be put in the 
  233. -- script of the moveable directional button.
  234.  
  235. on leaveDB
  236.   setClearedFlag(false)
  237.   clearDatabase
  238.   global IndexIndex1, IndexIndex2, IndexIndex3, IndexIndex4
  239.   set indexIndex1 = ""
  240.   set indexIndex2 = ""
  241.   set indexIndex3 = ""
  242.   set indexIndex4 = ""
  243.   
  244.   global browserTopics, masterBrowserTopics
  245.   set browserTopics = EMPTY
  246.   set masterBrowserTopics = EMPTY
  247.   set the keyDownScript = EMPTY
  248.   set the keyUpScript = EMPTY
  249.   clearSearchTopicField -- for next time
  250.   put " " into field "browser"
  251.   -- reset puppets
  252.   
  253.   -- reset cursors
  254.   
  255.   sound stop 1
  256.   pass -- to cast script of the clicked button that takes you out of the database
  257. end
  258.  
  259. -- ---------------------------------------------------------------
  260. -- Handler stopMovie 
  261.  
  262. on stopMovie
  263.   leaveDB
  264. end